<?php

error_reporting(E_ALL);

/**
 * LaboratorioinDRE - class.session.php
 *
 * $Id$
 *
 * This file is part of LaboratorioinDRE.
 *
 * Automatically generated on 14.11.2009, 03:31:49 with ArgoUML PHP module 
 * (last revised $Date: 2008-04-19 08:22:08 +0200 (Sat, 19 Apr 2008) $)
 *
 * @author Miguel Angel Chavez
 */

if (0 > version_compare(PHP_VERSION, '5')) {
    die('This file was generated for PHP 5');
}

/* user defined includes */
// section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC5-includes begin
// section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC5-includes end

/* user defined constants */
// section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC5-constants begin
// section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC5-constants end

/**
 * Short description of class session
 *
 * @access public
 * @author Miguel Angel Chavez
 */
class session
{
    // --- ASSOCIATIONS ---


    // --- ATTRIBUTES ---

    /**
     * Short description of attribute tiempo
     *
     * @access private
     * @var int
     */
    private $tiempo ="";

    // --- OPERATIONS ---

    /**
     * Short description of method __construct
     *
     * @access public
     * @author Miguel Angel Chavez
     * @return void
     */
    public function __construct()
    {
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC6 begin
         session_start();
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC6 end
    }

    /**
     * Short description of method cierraSesion
     *
     * @access public
     * @author Miguel Angel Chavez
     * @return void
     */
    public function cierraSesion()
    {
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC8 begin
        session_destroy();
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FC8 end
    }

    /**
     * Short description of method numeroSesion
     *
     * @access public
     * @author Miguel Angel Chavez
     * @return void
     */
    public function numeroSesion()
    {
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FCA begin
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FCA end
    }

    /**
     * Short description of method duraSesion
     *
     * @access public
     * @author Miguel Angel Chavez
     * @return void
     */
    public function duraSesion()
    {
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FD3 begin
        date_default_timezone_set("America/Mexico_city");

        $tiempo=1200;
        if (!isset($_SESSION['timeout_idle'])) {
            $_SESSION['timeout_idle'] = time() + $tiempo;
        } else {
            if ($_SESSION['timeout_idle'] < time()) {
                        $this->cierraSesion();
                        echo "<script language='javascript'>\n";
                        echo "var texto = 'El tiempo de inactividad ha superado los 20 min. Necesita validar sus claves nuevamente para continuar.';";
                        echo "alert(texto);\n";
                        echo "window.location.href = 'index.php';\n</script>";
            } else {
                $_SESSION['timeout_idle'] = time() + $tiempo;
            }
        }
        // section -64--88-2-24-513992c7:124f13883b7:-8000:0000000000000FD3 end
    }

} /* end of class session */

?>